package com.epoint.mobileoa.personalized.epointcompany.bizlogic;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.dom4j.Element;

import android.os.Message;

import com.epoint.mobileoa.bizlogic.SuperView;
import com.epoint.mobileoa.bizlogic.Task;
import com.epoint.mobileoa.datanalysis.XMLHelp;
import com.epoint.mobileoa.http.HttpHelp;
import com.epoint.mobileoa.personalized.epointcompany.model.ChuchaijihualistModel;
import com.epoint.mobileoa.personalized.epointcompany.model.ProjectInfoModel;

/**
 * @author liyc
 * @time 2012-4-18 下午7:32:45
 * @annotation 
 */
public class GetChuchaijihuaListTask extends Task {

	public GetChuchaijihuaListTask(SuperView con, HashMap<String, Object> param) {
		super(con, param);
	}

	@Override
	public void exectue(Message mess) throws Exception {
		String pagecount = getParam().get("pagecount").toString();
		String pageindex = getParam().get("pageindex").toString();
		String seamurl = generateURL("Epoint_GetBusinessTripPlanList",pagecount,pageindex);
		String bs = HttpHelp.getHttpBack(seamurl);
		setMessageToRefreshUI(mess, getCon(), bs);
	}
	
	public static List<ChuchaijihualistModel> XmlAnalysis(String xml){
		List focs = XMLHelp.getRoot(xml).elements();
		List<ChuchaijihualistModel> plist = new ArrayList<ChuchaijihualistModel>();
		for (int i = 0; i < focs.size(); i++) {
			ChuchaijihualistModel mt = new ChuchaijihualistModel();
			Element foc = (Element) focs.get(i);
			if (foc.element("date") != null)
				mt.date = foc.elementText("date");
			plist.add(mt);
		}
		return plist;
	}

}
